package com.fenghongzhang.day012;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyReceiver3 extends BroadcastReceiver {

    private static final String TAG = "MyReceiver3";
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if(action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)){
            Log.i(TAG, "onReceive: 飞行模式改变");
        }else if (action.equals(Intent.ACTION_USER_PRESENT)){
            Log.i(TAG, "onReceive: 屏幕亮了");
        }

        NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        Notification.Builder builder = new Notification.Builder(context);

        builder.setSmallIcon(R.mipmap.ic_launcher);
        builder.setContentTitle("biaoti");

        manager.notify(2,builder.build());



    }
}
